package com.example.springeventlistenersample.listener;

import com.example.springeventlistenersample.SpringEvent1;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

@Component
public class RegisterApplicationListener implements ApplicationListener<SpringEvent1> {
    Logger log = LoggerFactory.getLogger(RegisterApplicationListener.class);


    @Override
    public void onApplicationEvent(SpringEvent1 event) {
        log.info("ApplicationListener接收到注册事件："+event.getData().getName());
    }

    @Override
    public boolean supportsAsyncExecution() {
        return ApplicationListener.super.supportsAsyncExecution();
    }
}
